//---------------------------------------------------------------------------
function Ajax()
{
	this.send = function(url, params, callback) {
		this.request = null;
		if (window.XMLHttpRequest) { // native XMLHttpRequest object
			this.request = new XMLHttpRequest();
		} else if (window.ActiveXObject) { // IE/Windows ActiveX version
			this.request = new ActiveXObject("Microsoft.XMLHTTP");
		}

		if (this.request != null) {
			this.callback = callback;
			this.request.onreadystatechange = function() {ajax.recv();}
			this.request.open("POST", url, true);
			this.request.setRequestHeader("Content-Type",
					"application/x-www-form-urlencoded; charset=UTF-8");
			this.request.send(params);
		}

	}

	this.recv = function() {
		if (this.request.readyState == 4) {
			if (this.request.status == 200) {
				if (this.callback != null)
					this.callback(this.request.responseText);
			} else {
				alert('Request error:' + this.request.statusText);
			}
		}
	}

	this.callback = null;
	this.request = null;
}
//---------------------------------------------------------------------------
var ajax = new Ajax();
//---------------------------------------------------------------------------
